package net.adriana.esaytool;

import java.io.InputStream;
import java.util.Properties;

public class PropertyReader {
	static private Properties ps;
	
	static{
		ps = new Properties();
		try {
			InputStream in = PropertyReader.class.getResourceAsStream("/const.properties");
			ps.load(in);
			in.close();
		} catch (Exception e) {
			Logger.log(Logger.ERROR,"配置文件读取失败：" + e.getMessage());
		}
	}

	public static String get(String key) {
		String str = (String) ps.get(key);
		if(str == null) Logger.log(Logger.ERROR, "配置属性读取失败：" + key);
		return str;
	}
	
	public static void set(String key,String value){
		ps.setProperty(key, value);
		Logger.log(Logger.CHECK, "设置配置属性：[" + key + "=" + value + "]");
	}
}
